#include <stdbool.h>
bool IsLetter(char a)
{
    if(a>='a'&&a<='z'||a>='A'&&a<='Z')
    {
        return true;
    }
    return false;
}
void swap(char *a,char *b)
{
    char temp=*a;
    *a=*b;
    *b=temp;
}

void reverse(char* s,int start,int end)
{
    int len=strlen(s);
    int left=0;
    int right=len-1;
    while(1)
    {
        while(left<right&&(IsLetter (s[right])==false))
        {
            right--;
        }
        while(left<right&&(IsLetter (s[left])==false))
        {
            left++;
        }
        if(left>=right)
        {
            break;
        }
        swap(s+left,s+right);
        left++;
        right--;
    }
}
char* reverseOnlyLetters(char* s) 
{   int len=strlen(s);
   reverse(s,0,len-1);
    return s;
}